"use strict";

const Controller = require("egg").Controller;
class UsersController extends Controller {
  // 用户注册
  async registered() {
    const { ctx} = this;
    let params=ctx.request.body
    await ctx.service.uses.registered(params);
  }
  // 用户登录
  async login() {
    const { ctx} = this;
    let params=ctx.request.body
    await ctx.service.uses.login(params);
  }
  // 修改密码
  async changePassword() {
    const { ctx} = this;
    let params=ctx.request.body
    await ctx.service.uses.changePassword(params);
  }
  // 获取所有用户
   async getAllUser() {
    const { ctx} = this;
    await ctx.service.uses.getAllUser();
  }
  // 获取用户
  async getUser() {
    const { ctx} = this;
    let id=ctx.params.id
    await ctx.service.uses.getUser(id);
  }
  // 修改用户信息
  async update() {
    const { ctx} = this;
    let id=ctx.params.id
    let payload=ctx.request.body
    await ctx.service.uses.update(id,payload);
  }
}

module.exports = UsersController;
